<?

function getDirectoryList ($directory) 
  {

    // create an array to hold directory list
    $results = array();

    // create a handler for the directory
    $handler = opendir($directory);

    // open directory and walk through the filenames
    while ($file = readdir($handler)) {

      // if file isn't this directory or its parent, add it to the results
      if ($file != "." && $file != ".." ) {
        $results[] = $file;
      }

    }

    // tidy up: close the handler
    closedir($handler);

    // done!
    return $results;

  }

  function createSelect($name, $arr_values,$selected = "", $additionals = "") {
        $str_content = "<select id='" . $name . "' name='" . $name . "' size='1' " . $additionals . " class='selectbox'>";
        if (is_array($arr_values)) {
            foreach ($arr_values as $key=>$arr_value) {
                $str_content .= "<option value='" . $key . "'" . ($key == $selected ? " SELECTED" : "") . ">" . $arr_value . "</option>";
            }
        }
        $str_content .= "</select>";

        return $str_content;
    }

?>